package cn.zsssgjcx.hjsg.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import java.util.List;

import cn.zsssgjcx.hjsg.R;
import cn.zsssgjcx.hjsg.model.BusInfo;

public class BusAdapter extends BaseAdapter {

    private List<BusInfo> mlist;
    private LayoutInflater inflater;
    private Context context;
    private View.OnClickListener onClickListener;

    public BusAdapter(Context context, List<BusInfo> list) {
        this.context = context;
        this.mlist = list;
        inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    }


    @Override
    public int getCount() {
        return mlist.size();
    }

    @Override
    public Object getItem(int i) {
        return  mlist.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        if(view==null)
        {
            view = inflater.inflate(R.layout.item_bus,null);
        }
        return view;
    }
}
